<template>
	<div class="wdxq1">
		<div class="wdxq_title flex align_center">
			<i class="el-icon-arrow-left" style="float: left;margin-left: 4%;font-size: 2.4rem;" @click="fh"></i>
			<span class="flex1">订购会员</span>
			<i class="el-icon-arrow-left" style="float: right;margin-right: 4%;font-size: 2.4rem;opacity: 0;"></i>
		</div>
		<img style="width: 100%;display: block;" src="../../../../static/img/images/hydg.jpg" />
		<div class="wdxq_div15 flex align_center" v-for="(data,key) in list" @click="dashan(data.price,data.id)">
			<p class="wdxq_div15p1 ">{{data.month}}个月</p>
			<p class="wdxq_div15p2">￥<span>{{data.price}}</span></p>
			<p class="wdxq_div15p3 flex1">￥{{data.original_price}}</p>
			<img src="../../../../static/img/images/hydg10.png" class="wdxq_div15img" />
			<p class="wdxq_div15p5 flex align_center">购买</p>
			<img src="../../../../static/img/images/hydg2.jpg" class="wdxq_div15img2" v-if="data.is_promot==1"  />
		</div>
		
		
		<div class="wdxq_div16">
			<p class="wdxq_div16p1">热门会员特权</p>
			<div class="wdxq_div16d clear2">
				<div class="wdxq_div16img" v-for="(data,key) in hytx">
					<img :src="data.img" class="wdxq_div16img1" />
					<p class="wdxq_div16img2">{{data.name}}</p>
				</div>
			</div>
		</div>
		
		
		

	</div>
</template>

<script>
	import { Toast } from 'mint-ui';
	export default {
		data: function() {
			return {
				Height:0,
				tabI:0,
				hytx:[{
					'img':'../../../../static/img/images/hydg1.png',
					'name':'优先资料审核'
				},{
					'img':'../../../../static/img/images/hydg2.png',
					'name':'查看会员私信'
				},{
					'img':'../../../../static/img/images/hydg3.png',
					'name':'专属精准搜索'
				},{
					'img':'../../../../static/img/images/hydg4.png',
					'name':'首页推荐展示'
				},{
					'img':'../../../../static/img/images/hydg5.png',
					'name':'红娘1对1服务'
				},{
					'img':'../../../../static/img/images/hydg6.png',
					'name':'尊贵身份标识'
				}],
				div3list:[{
					'name':'微信认证 ',
					'botter':false,
					'index':1,
					'img':'../../../../static/img/images/rzzx2.jpg',
					'router':'/wode/rzzx'
					
				},{
					'name':'手机认证',
					'botter':false,
					'index':1,
					'img':'../../../../static/img/images/rzzx3.jpg',
					'router':'/wode/sjrz'
				},{
					'name':'实名认证 ',
					'botter':false,
					'index':1,
					'img':'../../../../static/img/images/rzzx4.jpg',
					'router':'/wode/sfrz'
				}],
				list:[],

			}
		},
		mounted() {
			this.Height=document.body.offsetHeight;
			this.getMemberCardList();
		},
		methods: {
			fh(){
        		window.history.go(-1);
        	},
        	
        	getMemberCardList(){
        		this.$http.post(this.defines.getMemberCardList, {
						uid: window.uid,
					}, {
						emulateJSON: true
					})
					.then(
						(data) => {
							if(data.data.success){
								this.list=data.data.data.list;
							}
							else{
							}
						},
						(error) => {
							console.log(error);
						}
					);
        	},
        	dashan(val,id){
				let num = parseFloat(val);
				num=num*100;
				this.$http.post(this.defines.creatMemberCardOrder, {
						uid: window.uid,
						dy_id:id,
					}, {
						emulateJSON: true
					})
					.then(
						(data) => {
							if(data.data.success){
								this.weixinzhifu(data.data.data.order_code)
							}
							else{
							}
						},
						(error) => {
							console.log(error);
						}
					);
			},
			weixinzhifu(code){
				
				this.$http.post(this.defines.WxPay, {
						uid: window.uid,
						order_code:code,
					}, {
						emulateJSON: true
					})
					.then(
						(data) => {
							if(data.data.success){
								console.log(data);
								WeixinJSBridge.invoke(
							        'getBrandWCPayRequest', data.data.data.jsApiParameters, 
							        function(res){
							            if(res.err_msg == "get_brand_wcpay_request:ok" ) {
							            	Toast('支付成功');
							            	this.fh();
							            	
							            }else{
							            	Toast(res.err_code+res.err_desc+res.err_msg);
							            }
							        }
							    );
							}
							else{
							}
						},
						(error) => {
							console.log(error);
						}
					);
			},
		}
	}
</script>
